﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace TestOnlineProject.Models.Entities
{
    public class TestModel
    {
        public string Title { get; set; }
        public string Subject { get; set; }
        public int userTestId { get; set; }
        public int NumberOfQuestions { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime FinishTime { get; set; }
        public int Duration { get; set; }
        public double Mark { get; set; }
        public List<QuestionModel> Questions { get; set; }
    }

    public class QuestionModel
    {
        public int QuestionId { get; set; }
        public int QuestionTypeId { get; set; }
        [Required(ErrorMessage = "The Section is reiquired.")]
        public int SectionId { get; set; }
        public int SubjectId { get; set; }
        [Required(ErrorMessage = "The Title is required.")]
        [AllowHtml]
        [StringLength(100, MinimumLength = 5, ErrorMessage = "The Title length is 5-100 characters.")]
        public string Title { get; set; }
        [Required(ErrorMessage = "The Question is required.")]
        [AllowHtml]
        [StringLength(500, MinimumLength = 12, ErrorMessage = "The Question length is 5-500 characters.")]
        public string Content { get; set; }
        public List<AnswerModel> Answers { get; set; }
        public List<MatchModel> Matchs { get; set; }
        public List<MatchModel> InvalidMatchs { get; set; }
        public double Mark { get; set; }
        [AllowHtml]
        [StringLength(100, MinimumLength = 12, ErrorMessage = "The Explanation length is 5-100 characters.")]
        public string Explanation { get; set; }
        public DateTime CreatedTime { get; set; }
        public DateTime LastEditedTime { get; set; }
    }

    public class AnswerModel
    {
        public int AnswerId { get; set; }
        [Required(ErrorMessage="The Answer is reiquired.")]
        [AllowHtml]
        [StringLength(500, MinimumLength = 1, ErrorMessage = "The Answer length is 1-500 characters.")]
        public string Content { get; set; }
        public double Grade { get; set; }
        public bool Checked { get; set; }
        public int MatchId { get; set; }
    }

    public class MatchModel
    {
        public int MatchId { get; set; }
        [Required(ErrorMessage = "The Match is required.")]
        [StringLength(100, MinimumLength = 1, ErrorMessage = "The Match length is 1-100 characters.")]
        public string Content { get; set; }
    }
    public class SectionModel 
    {
        public int SectionId { get; set; }
        public string Name { get; set; }
        public DateTime CreatedTime { get; set; }
        public DateTime LastEditedTime { get; set; }
        public bool isActivated { get; set; } 
    }
}